import java.util.List;

/**
 * Created by user on 26.01.14.
 */
public class myThread2 implements Runnable {
    private List<String> all;
    private boolean flag = true;

    public myThread2(List<String> all) {
        this.all = all;
    }

    @Override
    public void run() {
        while (flag) {

            try {
                synchronized (all) {
                    System.out.println("Now size: " + all.size());
                    Thread.sleep(500);
                }
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    public void setFlag(boolean flag) {
        this.flag = flag;
    }
}
